package nowcoder.written_examination.baidu;

import java.util.Scanner;

/**
 * @author fance
 * @date 18-6-30 上午9:42
 */
class Point {
    public String color;
    public double x;
    public double y;
    public double z;

    public Point(String color, double x, double y, double z) {
        this.color = color;
        this.x = x;
        this.y = y;
        this.z = z;
    }
}

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            int n = scanner.nextInt();
            Point[] a = new Point[n];
            for (int i = 0; i < n; i++) {
                a[i] = new Point(scanner.next(),scanner.nextDouble(),
                        scanner.nextDouble(),scanner.nextDouble());
            }
            double maxArea = 0.00000;
            for (int i = 0; i < n - 2; i++) {
                for (int j = i + 1; j < n - 1; j++) {
                    for (int k = j + 1; k < n; k++) {
                        if ((a[i].color.equals(a[j].color) && a[i].color.equals(a[k].color) && a[i].color.equals(a[k].color)) ||
                                (!a[i].color.equals(a[j].color) && !a[i].color.equals(a[k].color) && !a[j].color.equals(a[k].color))) {
                            double a1 =  Math.sqrt((a[i].x - a[j].x) * (a[i].x - a[j].x) + (a[i].y - a[j].y) * (a[i].y - a[j].y) +  (a[i].z - a[j].z) * (a[i].z - a[j].z));
                            double b1 =  Math.sqrt((a[i].x - a[k].x) * (a[i].x - a[k].x) + (a[i].y - a[k].y) * (a[i].y - a[k].y) +  (a[i].z - a[k].z) * (a[i].z - a[k].z));
                            double c1 =  Math.sqrt((a[k].x - a[j].x) * (a[k].x - a[j].x) + (a[k].y - a[j].y) * (a[k].y - a[j].y) +  (a[k].z - a[j].z) * (a[k].z - a[j].z));
                            double p = (a1 + b1 + c1) / 2;
                            if (a1 + b1 > c1 && a1 + c1 > b1 && b1 + c1 > a1) {
                                maxArea = Math.max(maxArea, Math.sqrt(p * (p - a1) * (p - b1) * (p - c1)));
                            }
                        }
                    }
                }
            }
            System.out.printf("%.5f",maxArea);
        }
    }
}
            /*int min = 5000;
            for (int i = 1; i < n - 1; i++) {
                List<Integer> tmp = new ArrayList<>(a.subList(0,i));
                tmp.addAll(a.subList(i + 1,a.size()));
                min = Math.min(min,cal(tmp));
            }
            System.out.println(min);
        }
    }
    private static int cal(List<Integer> a) {
        int sum = 0;
        for (int i = 0; i < a.size() - 1; i++) {
            sum += Math.abs(a.get(i + 1) - a.get(i));
        }
        return sum;
    }*/

    /*public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            Set<Integer> set = new TreeSet<>();
            int n = scanner.nextInt();
            for (int i = 0; i < n; i++) {
                set.add(scanner.nextInt());
            }
            if (set.size() < 3) {
                System.out.println(-1);
                continue;
            }
            int i = 0;
            for (Integer price : set) {
                i++;
                if (i == 3) {
                    System.out.println(price);
                    break;
                }
            }
        }
    }
}*/
